package baseFx.common.context.spring;

import java.util.regex.Pattern;

public class DefaultScopeSetting {
    private Pattern pattern;
    private String scope;
    private String target;

    public DefaultScopeSetting(String target, String scope) {
        this.scope = scope;
        this.target = target;
        String regex = target.replace(".", "\\.").replace("*", ".*");
        pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
    }

    public boolean matches(String className) {
        return pattern.matcher(className).matches();
    }

    public String getScope() {
        return scope;
    }

    public String getTarget() {
        return target;
    }
}
